<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
$(function(){
	$("#saveButton").click(function(){
		var userName = $("#userName").val();
		var passWord = $("#passWord").val();
		var cnName = $("#cnName").val();
		var college = $("#college").val();
		var theClass = $("#theClass").val();
		var grade = $("#grade").val();
		var sex = $("#sex").combobox('getValue');
		var storiedBuilding = $("#storiedBuilding").val();
		var dormitory = $("#dormitory").val();
		if(userName!="" && passWord!="" && cnName!="" && college!="" && theClass!="" && grade!=""){
			$.ajax({
				type:'POST',
				url:"UserManagementAdd.action",
				data:{dormitory:dormitory,userName:userName,passWord:passWord,cnName:cnName,college:college,theClass:theClass,grade:grade,storiedBuilding:storiedBuilding,sex:sex},
				datatype:'json',	
				success:function(msg){
					if(msg.state == "200"){
						parent.closeDialog();
					}
					if(msg.state == "500"){
						//alert("cunzai");
						$.messager.alert("提示","账户已经存在");
						//parent.closeDialog();
					}
					if(msg.state == "400"){
						$.messager.alert("提示","新增账户失败");
					}
				}
			});
		}else{
			$.messager.alert("提示","信息填写不完整");
		}
	});
});

/*$("#saveButton").click(function(){
	if($("#scheduleForm").form('validate')){
		$(this).attr("disabled",true);
		save();
	}
});*/

/*function save(){
	alert("1");
	var userName = $("#userName").val();
	var passWord = $("#passWord").val();
	var cnName = $("#cnName").val();
	var college = $("#college").val();
	var theClass = $("#theClass").val();
	var grade = $("#grade").val();
	var sex = $("#sex").val();
	var storiedBuilding = $("#storiedBuilding").val();
	if(userName!=null && passWord!=null && cnName!=null && college!=null && theClass!=null && grade!=null &&){
		$.ajax({
			type:'POST',
			url:"UserManagementAdd.action",
			data:{userName:userName,passWord:passWord,cnName:cnName,college:college,theClass:theClass,grade:grade,storiedBuilding:storiedBuilding},
			datatype:'json',	
			success:function(msg){
				if(msg.state == "200"){
					parent.closeDialog();
				}else if(msg.state == "500"){
					$.massager.alert("账户存在了");
				}else{
					$.messager.alert("提示","新增账户失败");
				}
			}
		});
	}else{
		$.messager.alert("提示","信息填写不完整");
	}
}*/


